Runtime Checks as Nominal Types
نویسندگان
چکیده
We propose a language design where types can be enriched by tags corresponding to predicates written by the programmer. For instance, int&positive is a type, where positive is a user-defined boolean function on integers. Expressions of type int&positive are obtained by an explicit check construct, analogous to cast, e.g., (positive) 2. In this way, the fact that the value of an expression is guaranteed to succeed a runtime check is a static property which can be controlled by the type system. We formalize our proposal as an extension of the simply-typed lambda calculus, and prove, besides soundness, the fact that expressions of tagged types reduce to values which satisfy the corresponding predicates.
منابع مشابه
Gradual Software-Based Memory Protection
Software-based memory protection (MP) provides not only spatial isolation of different applications, but also additional means to detect programming errors within an application. However, this luxury comes at the cost of extra runtime checks that add overhead to the application. In this paper, we present the idea of gradual software-based MP, where we only add a subset of runtime checks to a pr...
متن کاملA Type System for Safe Region-Based Memory Management in Real-Time Java
The Real-Time Specification for Java (RTSJ) allows a program to create real-time threads with hard real-time constraints. Real-time threads use immortal memory and region-based memory management to avoid unbounded pauses caused by interference from the garbage collector. The RTSJ uses runtime checks to ensure that deleting a region does not create dangling references and that real-time threads ...
متن کاملParallelize the Runtime Checks – Not the Application
Sequential and parallel applications are both prone to security and dependability bugs. Compilers can reduce the impact of these bugs by instrumenting runtime checks into the generated code. These runtime checks can have a dramatic negative impact on the performance of an application. For instance, our measurements show that compiler generated array-bounds checks can increase the application’s ...
متن کاملGradual Typestate
Typestate reflects how the legal operations on imperative objects can change at runtime as their internal state changes. A typestate checker can statically ensure, for instance, that an object method is only called when the object is in a state for which the operation is welldefined. Prior work has shown how modular typestate checking can be achieved thanks to access permissions and state guara...
متن کاملSimple algebraic data types for C
ADT is a simple tool in the spirit of Lex and Yacc that makes algebraic data types and a restricted form of pattern matching on those data types as found in SML available in C programs. ADT adds runtime checks, which make C programs written with the aid of ADT less likely to dereference a NULL pointer. The runtime tests may consume a significant amount of CPU time; hence they can be switched of...
متن کامل